import 'package:edu_assistant/generated/json/base/json_convert_content.dart';
import 'package:edu_assistant/model/file_data_entity.dart';
import 'package:edu_assistant/model/file_item_entity.dart';


FileDataEntity $FileDataEntityFromJson(Map<String, dynamic> json) {
  final FileDataEntity fileDataEntity = FileDataEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    fileDataEntity.total = total;
  }
  final List<FileItemEntity>? rows = (json['rows'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<FileItemEntity>(e) as FileItemEntity)
      .toList();
  if (rows != null) {
    fileDataEntity.rows = rows;
  }
  return fileDataEntity;
}

Map<String, dynamic> $FileDataEntityToJson(FileDataEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows?.map((v) => v.toJson()).toList();
  return data;
}

extension FileDataEntityExtension on FileDataEntity {
  FileDataEntity copyWith({
    int? total,
    List<FileItemEntity>? rows,
  }) {
    return FileDataEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}